package com.zr.gdms.controller;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.zr.gdms.service.ScoreService;
import com.zr.gdms.serviceimpl.ScoreServiceImpl;

import net.sf.json.JSONObject;

public class TotalStudentBySidControllerLPN extends HttpServlet{

	ScoreService ss = new ScoreServiceImpl();
	
	@Override
	protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
		this.doPost(req, resp);
	}
	
	@Override
	protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
		int sid = Integer.parseInt(req.getParameter("sid"));
		int total = ss.totalStudentScoreBySid(sid);
		JSONObject j = new JSONObject();
		j.put("total", total);
		PrintWriter pw = resp.getWriter();
		pw.write(j.toString());
		pw.flush();
		pw.close();
	}
}
